package com.hzlh.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hzlh.common.util.BaseConstants;
import com.hzlh.domain.po.AccountApplyInfo;
import com.hzlh.mapper.AccountMapper;

@Service
public class AccountService {
	@Autowired
	private AccountMapper mapper;
	
	/**
	 * 获取未审核通过用户信息
	 * @param weight
	 * @param pageIndex
	 * @param pageSize
	 * @return
	 */
	public Map<String,Object> applyPage(Map<String,Object> map){
		Map<String, Object> remap = new HashMap<String,Object>();
		int count = mapper.getAccountCount(map);
		List<AccountApplyInfo> list = null;
		if(count>0){
			list = mapper.getAccountPage(map);
//			list = mapper.getAccountPage1(map);
		}
		remap.put(BaseConstants.MCPP_HC_TOTAL_RECORDS, count);
		remap.put(BaseConstants.MCPP_HC_PAGE_DATA, list);
		return remap;
	}

	public AccountApplyInfo getApplyDetail(String id) {
		AccountApplyInfo accountInfo = new AccountApplyInfo();
		accountInfo = mapper.getAccounInfoByID(id);
		return accountInfo;
	}
	/**
	 * 由平台ID 查名称
	 * @param id
	 * @return
	 */
	public AccountApplyInfo getqueryusername(String id) {
		AccountApplyInfo accountInfo = new AccountApplyInfo();
		accountInfo = mapper.getqueryusername(id);
		return accountInfo;
	}
	
	/**
	 * 不予充值
	 * @param map
	 * @return
	 */
	public boolean reject(Map<String, String> map) {
		return mapper.reject(map) > 0;
	}

	/**
	 * 充值处理
	 * @param map
	 * @return
	 */
	public boolean pay(Map<String, String> map) {
		return mapper.pay(map) > 0;
	}

	/**
	 * 修改账户金额
	 * @param map
	 */
	public boolean updateAccountInfo(Map<String, String> map) {
		return mapper.updateAccountInfo(map) > 0;
	}
	/**
	 * 离线充值修改账户金额
	 * @param map
	 */
	public boolean updateAccountInfo1(Map<String, String> map) {
		return mapper.updateAccountInfo1(map) > 0;
	}
	/**
	 * 还现
	 * @param map
	 * @return
	 */
	public boolean repay(Map<String, String> map) {
		return mapper.repay(map) > 0;
	}
	/**
	 * 离线充值
	 * @param map
	 * @return
	 */
	public boolean offOperateinsert(Map<String, String> map) {
		return mapper.offOperateinsert(map);
	}
/**
 * 定时触发修改逾期状态
 * @return
 */
	public boolean updateRepayTimeStatus(){
		return mapper.updateRepayTimeStatus();
	}
}
